//
//  ButtonDemo.swift
//  FirstDemo
//
//  Created by liy on 2025/1/22.
//

import SwiftUI

struct ButtonDemo: View {
  var body: some View {
    VStack(spacing: 20) {
      Button("按钮A") {
        print("点击了我A")
      }
      // label: 自定义标签
      Button {
        print("点击了我B")
      } label: {
        Text("按钮B")
          .padding()
          .background(.blue, in: RoundedRectangle(cornerRadius: 20))
          .foregroundStyle(.white)
      }

      Button {
        print("点击了我C")
      } label: {
        Text("按钮C")
          .padding()
          .padding(.horizontal, 40)
          .background(content: {
            Color.blue
              .clipShape(RoundedRectangle(cornerRadius: 10))
          })
          .foregroundStyle(.white)
          .shadow(radius: 10)
      }

      // 系统图片
      Button("你好", systemImage: "heart") {
        print("点击了系统图片")
      }
    }
  }
}

#Preview {
  ButtonDemo()
}
